]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
WorkspacesView: don't fail when doing window DND from the last workspace
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 19 Jan 2013 01:26:44 +0000 (02:26 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 17 Mar 2013 18:35:14 +0000 (19:35 +0100)
DND of windows has a lot of side effects, including the possibility of
current workspace disappering from under our feet. We need to account
for that when trying to activate it.

https://bugzilla.gnome.org/show_bug.cgi?id=685285

js/ui/workspacesView.js

index ffabaf476f4a869d77e46355e6516120c2de1820..a409223d503105cf3ad002337588c41887a3179b 100644 (file)
@@ -389,6 +389,15 @@ const WorkspacesView = new Lang.Class({
         let current = Math.round(adj.value);
 
         if (active != current) {
+            if (!this._workspaces[current]) {
+                // The current workspace was destroyed. This could happen
+                // when you are on the last empty workspace, and consolidate
+                // windows using the thumbnail bar.
+                // In that case, the intended behavior is to stay on the empty
+                // workspace, which is the last one, so pick it.
+                current = this._workspaces.length - 1;
+            }
+
             let metaWorkspace = this._workspaces[current].metaWorkspace;
             metaWorkspace.activate(global.get_current_time());
         }